//
//  LZFTuiJianCell.m
//  LZFBuDieJie
//
//  Created by 梁梓烽 on 16/6/21.
//  Copyright © 2016年 liangzifeng. All rights reserved.
//

#import "LZFTuiJianCell.h"
#import "LZFTuiJianItem.h"
#import <UIImageView+WebCache.h>
#import "UIImage+Circle.h"


@interface LZFTuiJianCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *numberLabel;


@end
@implementation LZFTuiJianCell

//解析数据
-(void)setTuijianItem:(LZFTuiJianItem*)tuijianItem
{
    _tuijianItem=tuijianItem;
    
    //圆形头像
    //圆形的占位图片
   
  
    UIImage *placeHolderImage=[UIImage lzf_circleImageNamed:@"defaultUserIcon"];
    

    [self.iconImageView  sd_setImageWithURL:[NSURL URLWithString:tuijianItem.image_list] placeholderImage:placeHolderImage completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        
        if (image==nil) {
            return ;
        }
         //圆形图片
         self.iconImageView.image= [image circleImage];
        
    }];
    
    
    
    //主题
    self.nameLabel.text=tuijianItem.theme_name;
    
    //订阅人数
    double sub_num=tuijianItem.sub_number.intValue;
    if (sub_num>10000) {
        sub_num=sub_num/10000;
        self.numberLabel.text=[NSString stringWithFormat:@"%.1f万人订阅",sub_num];

    }
    else
    {
        self.numberLabel.text=[NSString stringWithFormat:@"%f人订阅",sub_num];
    }

  }


-(void)setFrame:(CGRect)frame
{
    frame.size.height-=1;
    [super setFrame:frame];
}
@end
